import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedHashSet;

/**
 * @Description
 * @Author zhaobaolin
 * @Date 2018/10/24
 */
public class LinkedHashSetTest {

    public static void main(String[] args) {
        handle();
    }

    private static void create()
    {
        HashSet<Integer> a1 = new LinkedHashSet<>();//创建一个LinkedHashSet
        HashSet<Integer> a2 = new LinkedHashSet(Arrays.asList(2.5,6));//将一个Collection集合初始化成LinkedHashSet
    }

    /**
     * 一般操作
     */
    private static void handle(){
        LinkedHashSet<String> a1 = new LinkedHashSet<>();
        a1.add("A");
        a1.add("A");
        a1.add("B");
        a1.add("D");
        a1.add("C");
        System.out.println(a1);//output：[A, B, D, C]

        int s = a1.size();
        System.out.println(s);//output：4

        a1.remove("A");
        System.out.println(a1);//output：[B, D, C]

    }

}
